<body class="gray-bg">
<div class="wrapper wrapper-content animated ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h5>{$page_title|default=''}</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <form id="pagerForm" method="post" class="form-inline searchForm">
                            <div class="col-sm-12">
                                <div class="input-group">
                                    <select name="type" class="form-control">
                                        <option value="">{:lang('收支类型')}</option>
                                        <option value="1">{:lang('收入')}</option>
                                        <option value="-1">{:lang('支出')}</option>
                                    </select>
                                </div>
                                <div class="input-group">
                                    <input type="text" name="member_id" placeholder="{:lang('会员ID')}" class="form-control">
                                </div>
                                <div class="input-group">
                                    <input type="text" name="book_id" placeholder="{:lang('账本ID')}" class="form-control" value="{$book_id}">
                                </div>
                                <div class="input-group">
                                    <input type="text" name="keywords" placeholder="{:lang('关键字搜索')}" class="form-control">
                                </div>
                                <div class="input-group">
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary ajaxSearchForm"><i
                                                class="fa fa-search"></i> {:lang('查询')}</button></span>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="ibox float-e-margins">
                <div class="ibox-content table-responsive">
                    <div class="row">
                        <div class="col-sm-12">
                            <lqf_link>
                                <a class="btn btn-info ajax-open" data-url="{:url('BkCategory/add',array('book_id'=>$book_id))}" width="800" height="600"><i
                                    class="fa fa-plus"></i> {:lang('添加')}</a>
                            </lqf_link>
                        </div>
                    </div>
                    <table class="table table-hover sorttable ajax-list-table" data-url="{:url('BkCategory/show_json')}"
                           width="100%">
                        <thead>
                        <tr>
                            <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                            <th width="200"><span>{:lang('分类名称')}</span></th>
                            <th width="80"><span>{:lang('收支类型')}</span></th>
                            <th width="80"><span>{:lang('图标')}</span></th>
                            <th width="80"><span>{:lang('会员ID')}</span></th>
                            <th width="80"><span>{:lang('账本ID')}</span></th>
                            <th width="80"><span>{:lang('排序')}</span></th>
                            <th width="80"  class="text-center">{:lang('是否显示')}</th>
                            <th width="80"  class="text-center">{:lang('操作')}</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                        <tfoot class="ibox-content">
                        <tr>
                            <td colspan="9" align="center"></td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script id="tableListTpl" type="text/html">
    <% for(var i=0;i<data.length;i++) {
    visible='';
    if(data[i]['visible']=='1') visible='checked';
    %>
    <tr>
        <td><input name="id" class="checkboxCtrlId" value="<%=data[i]['id']%>" type="checkbox"></td>
        <td><%=data[i]['name']%></td>
        <td>
            <% if(data[i]['type']=='1'){ %>
            <span class="label label-primary">{:lang('收入')}</span>
            <% }else if(data[i]['type']=='-1'){ %>
            <span class="label label-danger">{:lang('支出')}</span>
            <% } %>
        </td>
        <td>
            <% if(data[i]['type']=='1'){ %>
            <span class="btn btn-info btn-circle">
                <i class="icon iconfont <%=data[i]['category_icon']%>"></i>
            </span>
            <% }else if(data[i]['type']=='-1'){ %>
            <span class="btn btn-danger btn-circle">
                <i class="icon iconfont <%=data[i]['category_icon']%>"></i>
            </span>
            <% } %>
        </td>
        <td><%=data[i]['member_id']%></td>
        <td><%=data[i]['book_id']%></td>
        <td><input type="text" name="sort" value="<%=data[i]['sort']%>" class="form-control w50 ajax-sort"
                   data-url="{:url('BkCategory/set_sort',array('name'=>'sort'))}" data-id="<%=data[i]['id']%>" size="5">
        </td>
        <td class="text-center">
            <input name="visible" class="ajax-checkbox" type="checkbox"
                   data-url="{:url('BkCategory/set_visible',array('name'=>'visible'))}" data-id="<%=data[i]['id']%>"
            <%=visible%> >
        </td>
        <td class="text-center">
            <lqf_link><a class="ajax-open" data-url="{:url('BkCategory/edit')}" width="800" height="600"
                         data-ids="{'id':'<%=data[i]['id']%>'}" data-title="{:lang('修改')}">{:lang('修改')}</a></lqf_link>
            <lqf_link><a class="ajax-del confirm" data-url="{:url('BkCategory/del')}"
                         data-ids="{'id':'<%=data[i]['id']%>'}">{:lang('删除')}</a></lqf_link>
        </td>
    </tr>
    <% } %>
</script>
<script type="text/javascript">
    $(document).ready(function () {
        turnPage(1);
    });
</script>
{include file="bk_category/iconfont"}